using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class transports : MangosBase
	{
		public System.UInt32? entry;
		public System.String name;
		public System.UInt32? period;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `transports` (`entry`, `name`, `period`) VALUES ('{0}', '{1}', '{2}');", entry.GetValueOrDefault(), name.MySQLDBString(), period.GetValueOrDefault());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `transports` SET ");
			if(name != null)
			{
				sb.AppendLine("`name`='" + name.MySQLDBString() + "'");
			}
			if(period != null)
			{
				sb.AppendLine("`period`='" + period.Value.ToString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `entry`='" + entry.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
